package com.steamedfish.auctionsecurityserveroauth2.config;



import com.aliyun.dysmsapi20170525.Client;
import com.aliyun.teaopenapi.models.Config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.mail.SimpleMailMessage;

import java.util.Date;

@Configuration
public class MailAndSmsModelConfig {

    @Bean
    public SimpleMailMessage simpleMailMessage(){
        SimpleMailMessage msg = new SimpleMailMessage();
        msg.setFrom("meetml@126.com");
        msg.setSubject("蒸鱼校园拍买平台注册验证码");
//        msg.setTo();
        msg.setSentDate(new Date());
//        msg.setText();
        return msg;
    }

    @Bean
    public Client aliSmsClient() throws Exception {
        Config config = new Config()
                // 您的AccessKey ID
                .setAccessKeyId("LTAI4FrgeULKEeRmTZWB9maR")
                // 您的AccessKey Secret
                .setAccessKeySecret("qxK0MHc9koKBVB1GVanhmXwegZVjal");
        // 访问的域名
        config.endpoint = "dysmsapi.aliyuncs.com";
        return new Client(config);
    }

}